package com.lky.controller;

import com.lky.bean.Department;
import com.lky.bean.Msg;
import com.lky.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName: DepartmentController
 * @Author: Li_Kangyi
 * @Date: 2021/2/25 21:48
 * @Description: TODO 处理部门相关请求：
 */
@Controller
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    @ResponseBody
    @RequestMapping("/depts")
    public Msg getDepts(){
        List<Department> depts = departmentService.getAll();
        return Msg.success().add("depts",depts);
    }
}
